Page({
  data: {
    isLike: true,
    // banner
    indicatorDots: true, //是否显示面板指示点
    autoplay: true, //是否自动切换
    interval: 3000, //自动切换时间间隔,3s
    duration: 1000,//	滑动动画时长1s
    imgUrls: [
      'https://img11.360buyimg.com/n1/s450x450_jfs/t1/151425/21/9746/36151/5fcf0c3eEd184aeb5/4c217c5d5a808cea.jpg.avif',
      'https://img11.360buyimg.com/n1/s450x450_jfs/t1/88684/38/10030/146195/5e14287bEf52b9518/948d5784130bb033.jpg.avif',
      'https://img11.360buyimg.com/n1/s450x450_jfs/t1/104386/16/9991/169599/5e14287bE03e99b31/86654ca89073d4d7.jpg.avif',
      'https://img11.360buyimg.com/n1/s450x450_jfs/t1/93307/22/9726/195013/5e14287bEd0f90892/0ed52ab5d36ca67d.jpg.avif',
      'https://img11.360buyimg.com/n1/s450x450_jfs/t1/108819/32/3645/166615/5e14287cE4d0b7a29/e5497f1331097ab8.jpg.avif'
    ],


    // 商品详情介绍
    detailImg: [
     "https://img30.360buyimg.com/sku/jfs/t1/247723/34/15732/53561/669f013dFf615c950/37af3d3295790855.jpg",
     "https://img10.360buyimg.com/imgzone/jfs/t1/98290/26/13121/424993/5e53645fE3972a301/f241a374e4b2b0ca.jpg",
     "https://img10.360buyimg.com/imgzone/jfs/t1/98436/33/12948/505730/5e53645fEb0eeac86/23aa3015075fba3b.jpg",
     "https://img10.360buyimg.com/imgzone/jfs/t1/99567/16/13008/729810/5e53645fEb09cfbac/95ada3cda7aedb94.jpg",


    ],
  },
  //预览图片
  onLoad() {
    console.log(this.data.imgUrls); // 检查数据是否正常
  },
  previewImage(e) {
    wx.previewImage({
      current: e.currentTarget.dataset.src,
      urls: this.data.imgUrls

    })
  },
  // 收藏
  addLike() {
    this.setData({
      isLike: !this.data.isLike
    });
  },
  // 跳到购物车
  toCar() {
    wx.switchTab({
      url: '/pages/cart/cart'
    })
  },
  // 立即购买
  immeBuy() {
    wx.showToast({
      title: '购买成功',
      icon: 'success',
      duration: 2000
    });
  },
})